<?php

namespace Medicina\KernelBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;

/**
 * Medicina\KernelBundle\Entity\TipoDeCargo
 *
 * @ORM\Table(name="tipodecargo")
 * @ORM\Entity
 * @ORM\Entity(repositoryClass="Medicina\KernelBundle\Entity\TipoDeCargoRepository")
 */
class TipoDeCargo {

    /**
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @ORM\Column(name="duracion", type="string", length=10, nullable=false)
     */
    private $duracion;

    /**
     * @ORM\Column(name="nombre", type="string", length=50, nullable=false, unique=true)
     */
    private $nombre;

    /**
     * @ORM\Column(name="codigo", type="string", length=10, nullable=true, unique=false)
     */
    private $codigo;

    /**
     *  @ORM\OneToMany(targetEntity="Cargo", mappedBy="tipoDeCargo")
     */
    private $cargos;

    public function __construct() {
        $this->cargos = new \Doctrine\Common\Collections\ArrayCollection();
    }

    public function getId() {
        return $this->id;
    }

    public function setDuracion($duracion) {
        $this->duracion = $duracion;
    }

    public function getDuracion() {
        return $this->duracion;
    }

    public function setNombre($nombre) {
        $this->nombre = $nombre;
    }

    public function getNombre() {
        return $this->nombre;
    }

    public function setCodigo($codigo) {
        $this->codigo = $codigo;
    }

    public function getCodigo() {
        return $this->codigo;
    }

    public function addCargo(\Medicina\KernelBundle\Entity\Cargo $cargos) {
        $this->cargos[] = $cargos;
    }

    public function getCargos() {
        return $this->cargos;
    }

    public function __toString() {
        return $this->getNombre();
    }

}